
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
	<title>YUI Library Examples: Drag &amp; Drop: Drop Based Coding</title>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    	<link rel="stylesheet" type="text/css" href="../../assets/yui.css" >

<style>
    /*Supplemental CSS for the YUI distribution*/
    #custom-doc { width: 95%; min-width: 950px; }
    #pagetitle {background-image: url(../../assets/bg_hd.gif);}
/*    #pagetitle h1 {background-image: url(../../assets/title_h_bg.gif);}*/
</style>

<link rel="stylesheet" type="text/css" href="../../assets/dpSyntaxHighlighter.css">

<!--there is no custom header content for this example-->

<link type="text/css" rel="stylesheet" href="../../build/cssfonts/fonts-min.css" />
<script type="text/javascript" src="../../build/yui/yui-min.js"></script>

</head>
<body id="yahoo-com" class="yui3-skin-sam  yui-skin-sam">
<div id="custom-doc" class="yui-t2">
<div id="hd">
	<div id="ygunav">
		<p>
            <em>
                <a href="http://developer.yahoo.com/yui/3/">YUI 3.x Home</a> <i> - </i>	
            </em>
		</p>
		<form action="http://search.yahoo.com/search" id="sitesearchform">
            <input name="vs" type="hidden" value="developer.yahoo.com">
            <input name="vs" type="hidden" value="yuiblog.com">
			<input name="vs" type="hidden" value="yuilibrary.com">
		    <div id="sitesearch">
		    	<label for="searchinput">Site Search (YDN, YUILibrary &amp; YUIBlog): </label>
			    <input type="text" id="searchinput" name="p">
			    <input type="submit" value="Search" id="searchsubmit" class="ygbt">
		    </div>
		</form>
    </div>
	<div id="ygma"><a href="../../"><img src="../../assets/logo.gif"  border="0" width="200" height="93"></a></div>
	<div id="pagetitle"><h1>YUI Library Examples: Drag &amp; Drop: Drop Based Coding</h1></div>
</div>
<div id="bd">


	<div id="yui-main">
		<div class="yui-b">
		  <div class="yui-ge">
			  <div class="yui-u first example" id="main">

	<h2>Drag &amp; Drop: Drop Based Coding</h2>

	<div id="example" class="promo">
	<div class="example-intro">
	<p>This example shows how to use the Drop Target events to code your application.</p>
	</div>

	<div class="module example-container ">
			<div class="hd exampleHd">
			<p class="newWindowButton yui-skin-sam">
                <a href="drop-code_clean.html" target="_blank">View example in new window.</a>
            </p>
		</div>		<div id="example-canvas" class="bd">

	
	<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->

	<style>
    .drag {
        height: 50px;
        width: 50px;
        border: 1px solid black;
        background-color: #004C6D;
        color: white;
        cursor: move;
        float: left;
        margin: 4px;
        z-index: 2;
    }
    #play {
        border: 1px solid black;
        height: 300px;
        position: relative;
    }
    #drop {
        position: absolute;
        bottom: 5px;
        right: 5px;
        border: 1px solid black;
        background-color: #8DD5E7;
        height: 75px;
        width: 65%;
        z-index: 1;
    }
    #drop p {
        margin: 1em;
    }
    #drop p strong {
        font-weight: bold;
    }
    #drop.yui3-dd-drop-over {
        background-color: #FFA928;
    }
</style>

<div id="play">
    <div id="drag1" class="drag">Drag #1</div>
    <div id="drag2" class="drag">Drag #2</div>
    <div id="drag3" class="drag">Drag #3</div>
    <div id="drag4" class="drag">Drag #4</div>
    <div id="drag5" class="drag">Drag #5</div>
    <div id="drop"></div>
</div>

<script>

YUI({ filter: 'raw' }).use('dd-drop', 'dd-constrain', function(Y) {
    var data = {
        'drag1': { color: 'white', size: 'x-small', price: '$5.00' },
        'drag2': { color: 'blue', size: 'small', price: '$6.00' },
        'drag3': { color: 'green', size: 'medium', price: '$7.00' },
        'drag4': { color: 'red', size: 'large', price: '$10.00' },
        'drag5': { color: 'purple', size: 'x-large', price: '$15.00' }
    };
    var drags = Y.Node.all('#play div.drag');
    drags.each(function(v, k) {
        var thisData = {};
        Y.mix(thisData, data[v.get('id')]);
        var dd = new Y.DD.Drag({
            node: v,
            dragMode: 'intersect',
            data: thisData
        }).plug(Y.Plugin.DDConstrained, {
            constrain2node: '#play'
        });
        dd.on('drag:end', function(e) {
            e.preventDefault();
        });
    });

    var drop = new Y.DD.Drop({
        node: '#drop'
    });
    drop.on('drop:hit', function(e) {
        var drag = e.drag;
        var data = drag.get('data');
        var out = ['id: ' + drag.get('node').get('id')];
        Y.each(data, function(v, k) {
            out[out.length] = k + ': ' + v;
        });
        var str = '<p><strong>Dropped</strong>: ' + out.join(', ') + '</p>';
        this.get('node').set('innerHTML', str);
    });
});
</script>

	<!--END SOURCE CODE FOR EXAMPLE =============================== -->

	
		</div>
	</div>
	</div>

	<h3>Setting up the HTML</h3>
<p>First we need to create the HTML for the example.</p>
<div id="syntax-f3761fe6abc26a2ee3f88093e6c02ae4" class="yui-syntax-highlight"><div class="numbers"><pre class="html4strict" style="font-family:monospace;"><ol><li class="li1"><div class="de1"><span class="sc2">&lt;<span class="kw2">div</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;play&quot;</span>&gt;</span></div></li><li class="li1"><div class="de1">    <span class="sc2">&lt;<span class="kw2">div</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;drag1&quot;</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">&quot;drag&quot;</span>&gt;</span>Drag #1<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">div</span>&gt;</span></div></li><li class="li1"><div class="de1">    <span class="sc2">&lt;<span class="kw2">div</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;drag2&quot;</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">&quot;drag&quot;</span>&gt;</span>Drag #2<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">div</span>&gt;</span></div></li><li class="li1"><div class="de1">    <span class="sc2">&lt;<span class="kw2">div</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;drag3&quot;</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">&quot;drag&quot;</span>&gt;</span>Drag #3<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">div</span>&gt;</span></div></li><li class="li2"><div class="de2">    <span class="sc2">&lt;<span class="kw2">div</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;drag4&quot;</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">&quot;drag&quot;</span>&gt;</span>Drag #4<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">div</span>&gt;</span></div></li><li class="li1"><div class="de1">    <span class="sc2">&lt;<span class="kw2">div</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;drag5&quot;</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">&quot;drag&quot;</span>&gt;</span>Drag #5<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">div</span>&gt;</span></div></li><li class="li1"><div class="de1">    <span class="sc2">&lt;<span class="kw2">div</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;drop&quot;</span>&gt;&lt;<span class="sy0">/</span><span class="kw2">div</span>&gt;</span></div></li><li class="li1"><div class="de1"><span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">div</span>&gt;</span></div></li></ol></pre></div><div class="nonumbers"><pre class="html4strict" style="font-family:monospace;"><span class="sc2">&lt;<span class="kw2">div</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;play&quot;</span>&gt;</span>
    <span class="sc2">&lt;<span class="kw2">div</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;drag1&quot;</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">&quot;drag&quot;</span>&gt;</span>Drag #1<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">div</span>&gt;</span>
    <span class="sc2">&lt;<span class="kw2">div</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;drag2&quot;</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">&quot;drag&quot;</span>&gt;</span>Drag #2<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">div</span>&gt;</span>
    <span class="sc2">&lt;<span class="kw2">div</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;drag3&quot;</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">&quot;drag&quot;</span>&gt;</span>Drag #3<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">div</span>&gt;</span>
    <span class="sc2">&lt;<span class="kw2">div</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;drag4&quot;</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">&quot;drag&quot;</span>&gt;</span>Drag #4<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">div</span>&gt;</span>
    <span class="sc2">&lt;<span class="kw2">div</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;drag5&quot;</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">&quot;drag&quot;</span>&gt;</span>Drag #5<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">div</span>&gt;</span>
    <span class="sc2">&lt;<span class="kw2">div</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;drop&quot;</span>&gt;&lt;<span class="sy0">/</span><span class="kw2">div</span>&gt;</span>
<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">div</span>&gt;</span></pre></div><textarea id="syntax-f3761fe6abc26a2ee3f88093e6c02ae4-plain"><div id="play">
    <div id="drag1" class="drag">Drag #1</div>
    <div id="drag2" class="drag">Drag #2</div>
    <div id="drag3" class="drag">Drag #3</div>
    <div id="drag4" class="drag">Drag #4</div>
    <div id="drag5" class="drag">Drag #5</div>
    <div id="drop"></div>
</div></textarea></div><p>Now we give the HTML some CSS to make them visible.</p>
<div id="syntax-8e01af378c7b65f0d2f1fc2b21d5598b" class="yui-syntax-highlight"><div class="numbers"><pre class="css" style="font-family:monospace;"><ol><li class="li1"><div class="de1"><span class="re1">.drag</span> <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">    <span class="kw1">height</span><span class="sy0">:</span> <span class="re3">50px</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">    <span class="kw1">width</span><span class="sy0">:</span> <span class="re3">50px</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">    <span class="kw1">border</span><span class="sy0">:</span> <span class="re3">1px</span> <span class="kw2">solid</span> <span class="kw1">black</span><span class="sy0">;</span></div></li><li class="li2"><div class="de2">    <span class="kw1">background-color</span><span class="sy0">:</span> <span class="re0">#004C6D</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">    <span class="kw1">color</span><span class="sy0">:</span> <span class="kw2">white</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">    <span class="kw1">cursor</span><span class="sy0">:</span> move<span class="sy0">;</span></div></li><li class="li1"><div class="de1">    <span class="kw1">float</span><span class="sy0">:</span> <span class="kw1">left</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">    <span class="kw1">margin</span><span class="sy0">:</span> <span class="re3">4px</span><span class="sy0">;</span></div></li><li class="li2"><div class="de2">    <span class="kw1">z-index</span><span class="sy0">:</span> <span class="nu0">2</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li><li class="li1"><div class="de1"><span class="re0">#play</span> <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">    <span class="kw1">border</span><span class="sy0">:</span> <span class="re3">1px</span> <span class="kw2">solid</span> <span class="kw1">black</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">    <span class="kw1">height</span><span class="sy0">:</span> <span class="re3">300px</span><span class="sy0">;</span></div></li><li class="li2"><div class="de2">    <span class="kw1">position</span><span class="sy0">:</span> <span class="kw2">relative</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li><li class="li1"><div class="de1"><span class="re0">#drop</span> <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">    <span class="kw1">position</span><span class="sy0">:</span> <span class="kw2">absolute</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">    <span class="kw1">bottom</span><span class="sy0">:</span> <span class="re3">5px</span><span class="sy0">;</span></div></li><li class="li2"><div class="de2">    <span class="kw1">right</span><span class="sy0">:</span> <span class="re3">5px</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">    <span class="kw1">border</span><span class="sy0">:</span> <span class="re3">1px</span> <span class="kw2">solid</span> <span class="kw1">black</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">    <span class="kw1">background-color</span><span class="sy0">:</span> <span class="re0">#8DD5E7</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">    <span class="kw1">height</span><span class="sy0">:</span> <span class="re3">75px</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">    <span class="kw1">width</span><span class="sy0">:</span> <span class="re3"><span class="nu0">65</span>%</span><span class="sy0">;</span></div></li><li class="li2"><div class="de2">    <span class="kw1">z-index</span><span class="sy0">:</span> <span class="nu0">1</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li><li class="li1"><div class="de1"><span class="re0">#drop</span> p <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">    <span class="kw1">margin</span><span class="sy0">:</span> <span class="re3">1em</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li><li class="li2"><div class="de2"><span class="re0">#drop</span> p strong <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">    <span class="kw1">font-weight</span><span class="sy0">:</span> <span class="kw2">bold</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li><li class="li1"><div class="de1"><span class="re0">#drop</span><span class="re1">.yui3-dd-drop-over</span> <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">    <span class="kw1">background-color</span><span class="sy0">:</span> <span class="re0">#FFA928</span><span class="sy0">;</span></div></li><li class="li2"><div class="de2"><span class="br0">&#125;</span></div></li></ol></pre></div><div class="nonumbers"><pre class="css" style="font-family:monospace;"><span class="re1">.drag</span> <span class="br0">&#123;</span>
    <span class="kw1">height</span><span class="sy0">:</span> <span class="re3">50px</span><span class="sy0">;</span>
    <span class="kw1">width</span><span class="sy0">:</span> <span class="re3">50px</span><span class="sy0">;</span>
    <span class="kw1">border</span><span class="sy0">:</span> <span class="re3">1px</span> <span class="kw2">solid</span> <span class="kw1">black</span><span class="sy0">;</span>
    <span class="kw1">background-color</span><span class="sy0">:</span> <span class="re0">#004C6D</span><span class="sy0">;</span>
    <span class="kw1">color</span><span class="sy0">:</span> <span class="kw2">white</span><span class="sy0">;</span>
    <span class="kw1">cursor</span><span class="sy0">:</span> move<span class="sy0">;</span>
    <span class="kw1">float</span><span class="sy0">:</span> <span class="kw1">left</span><span class="sy0">;</span>
    <span class="kw1">margin</span><span class="sy0">:</span> <span class="re3">4px</span><span class="sy0">;</span>
    <span class="kw1">z-index</span><span class="sy0">:</span> <span class="nu0">2</span><span class="sy0">;</span>
<span class="br0">&#125;</span>
<span class="re0">#play</span> <span class="br0">&#123;</span>
    <span class="kw1">border</span><span class="sy0">:</span> <span class="re3">1px</span> <span class="kw2">solid</span> <span class="kw1">black</span><span class="sy0">;</span>
    <span class="kw1">height</span><span class="sy0">:</span> <span class="re3">300px</span><span class="sy0">;</span>
    <span class="kw1">position</span><span class="sy0">:</span> <span class="kw2">relative</span><span class="sy0">;</span>
<span class="br0">&#125;</span>
<span class="re0">#drop</span> <span class="br0">&#123;</span>
    <span class="kw1">position</span><span class="sy0">:</span> <span class="kw2">absolute</span><span class="sy0">;</span>
    <span class="kw1">bottom</span><span class="sy0">:</span> <span class="re3">5px</span><span class="sy0">;</span>
    <span class="kw1">right</span><span class="sy0">:</span> <span class="re3">5px</span><span class="sy0">;</span>
    <span class="kw1">border</span><span class="sy0">:</span> <span class="re3">1px</span> <span class="kw2">solid</span> <span class="kw1">black</span><span class="sy0">;</span>
    <span class="kw1">background-color</span><span class="sy0">:</span> <span class="re0">#8DD5E7</span><span class="sy0">;</span>
    <span class="kw1">height</span><span class="sy0">:</span> <span class="re3">75px</span><span class="sy0">;</span>
    <span class="kw1">width</span><span class="sy0">:</span> <span class="re3"><span class="nu0">65</span>%</span><span class="sy0">;</span>
    <span class="kw1">z-index</span><span class="sy0">:</span> <span class="nu0">1</span><span class="sy0">;</span>
<span class="br0">&#125;</span>
<span class="re0">#drop</span> p <span class="br0">&#123;</span>
    <span class="kw1">margin</span><span class="sy0">:</span> <span class="re3">1em</span><span class="sy0">;</span>
<span class="br0">&#125;</span>
<span class="re0">#drop</span> p strong <span class="br0">&#123;</span>
    <span class="kw1">font-weight</span><span class="sy0">:</span> <span class="kw2">bold</span><span class="sy0">;</span>
<span class="br0">&#125;</span>
<span class="re0">#drop</span><span class="re1">.yui3-dd-drop-over</span> <span class="br0">&#123;</span>
    <span class="kw1">background-color</span><span class="sy0">:</span> <span class="re0">#FFA928</span><span class="sy0">;</span>
<span class="br0">&#125;</span></pre></div><textarea id="syntax-8e01af378c7b65f0d2f1fc2b21d5598b-plain">.drag {
    height: 50px;
    width: 50px;
    border: 1px solid black;
    background-color: #004C6D;
    color: white;
    cursor: move;
    float: left;
    margin: 4px;
    z-index: 2;
}
#play {
    border: 1px solid black;
    height: 300px;
    position: relative;
}
#drop {
    position: absolute;
    bottom: 5px;
    right: 5px;
    border: 1px solid black;
    background-color: #8DD5E7;
    height: 75px;
    width: 65%;
    z-index: 1;
}
#drop p {
    margin: 1em;
}
#drop p strong {
    font-weight: bold;
}
#drop.yui3-dd-drop-over {
    background-color: #FFA928;
}</textarea></div>
<h3>Setting up the YUI Instance</h3>
<p>Now we need to create our YUI instance and tell it to load the <code>dd-drop</code> and <code>dd-constrain</code> modules.</p>
<div id="syntax-f95e05816522fd174065febfa3f5d09d" class="yui-syntax-highlight"><div class="numbers"><pre class="javascript" style="font-family:monospace;"><ol><li class="li1"><div class="de1">YUI<span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="kw2">use</span><span class="br0">&#40;</span><span class="st0">'dd-drop'</span><span class="sy0">,</span> <span class="st0">'dd-constrain'</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li></ol></pre></div><div class="nonumbers"><pre class="javascript" style="font-family:monospace;">YUI<span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="kw2">use</span><span class="br0">&#40;</span><span class="st0">'dd-drop'</span><span class="sy0">,</span> <span class="st0">'dd-constrain'</span><span class="br0">&#41;</span><span class="sy0">;</span></pre></div><textarea id="syntax-f95e05816522fd174065febfa3f5d09d-plain">YUI().use('dd-drop', 'dd-constrain');</textarea></div>
<h3>Making the Nodes draggable</h3>
<p>Now that we have a YUI instance with the <code>dd-drop</code> module, we need to instantiate the <code>Drag</code> instance on each Drag Node.</p>
<p>In this example we are using the data config option of the drag to associate data with this Drag instance.</p>
<p>So we have set up an object literal containing information about our drag items.</p>
<div id="syntax-fc4b180bb0ec9a8f9fa7b99cc8fcf032" class="yui-syntax-highlight"><div class="numbers"><pre class="javascript" style="font-family:monospace;"><ol><li class="li1"><div class="de1">    <span class="kw2">var</span> data <span class="sy0">=</span> <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">        <span class="st0">'drag1'</span><span class="sy0">:</span> <span class="br0">&#123;</span> color<span class="sy0">:</span> <span class="st0">'white'</span><span class="sy0">,</span> size<span class="sy0">:</span> <span class="st0">'x-small'</span><span class="sy0">,</span> price<span class="sy0">:</span> <span class="st0">'$5.00'</span> <span class="br0">&#125;</span><span class="sy0">,</span></div></li><li class="li1"><div class="de1">        <span class="st0">'drag2'</span><span class="sy0">:</span> <span class="br0">&#123;</span> color<span class="sy0">:</span> <span class="st0">'blue'</span><span class="sy0">,</span> size<span class="sy0">:</span> <span class="st0">'small'</span><span class="sy0">,</span> price<span class="sy0">:</span> <span class="st0">'$6.00'</span> <span class="br0">&#125;</span><span class="sy0">,</span></div></li><li class="li1"><div class="de1">        <span class="st0">'drag3'</span><span class="sy0">:</span> <span class="br0">&#123;</span> color<span class="sy0">:</span> <span class="st0">'green'</span><span class="sy0">,</span> size<span class="sy0">:</span> <span class="st0">'medium'</span><span class="sy0">,</span> price<span class="sy0">:</span> <span class="st0">'$7.00'</span> <span class="br0">&#125;</span><span class="sy0">,</span></div></li><li class="li2"><div class="de2">        <span class="st0">'drag4'</span><span class="sy0">:</span> <span class="br0">&#123;</span> color<span class="sy0">:</span> <span class="st0">'red'</span><span class="sy0">,</span> size<span class="sy0">:</span> <span class="st0">'large'</span><span class="sy0">,</span> price<span class="sy0">:</span> <span class="st0">'$10.00'</span> <span class="br0">&#125;</span><span class="sy0">,</span></div></li><li class="li1"><div class="de1">        <span class="st0">'drag5'</span><span class="sy0">:</span> <span class="br0">&#123;</span> color<span class="sy0">:</span> <span class="st0">'purple'</span><span class="sy0">,</span> size<span class="sy0">:</span> <span class="st0">'x-large'</span><span class="sy0">,</span> price<span class="sy0">:</span> <span class="st0">'$15.00'</span> <span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">    <span class="br0">&#125;</span><span class="sy0">;</span></div></li></ol></pre></div><div class="nonumbers"><pre class="javascript" style="font-family:monospace;">    <span class="kw2">var</span> data <span class="sy0">=</span> <span class="br0">&#123;</span>
        <span class="st0">'drag1'</span><span class="sy0">:</span> <span class="br0">&#123;</span> color<span class="sy0">:</span> <span class="st0">'white'</span><span class="sy0">,</span> size<span class="sy0">:</span> <span class="st0">'x-small'</span><span class="sy0">,</span> price<span class="sy0">:</span> <span class="st0">'$5.00'</span> <span class="br0">&#125;</span><span class="sy0">,</span>
        <span class="st0">'drag2'</span><span class="sy0">:</span> <span class="br0">&#123;</span> color<span class="sy0">:</span> <span class="st0">'blue'</span><span class="sy0">,</span> size<span class="sy0">:</span> <span class="st0">'small'</span><span class="sy0">,</span> price<span class="sy0">:</span> <span class="st0">'$6.00'</span> <span class="br0">&#125;</span><span class="sy0">,</span>
        <span class="st0">'drag3'</span><span class="sy0">:</span> <span class="br0">&#123;</span> color<span class="sy0">:</span> <span class="st0">'green'</span><span class="sy0">,</span> size<span class="sy0">:</span> <span class="st0">'medium'</span><span class="sy0">,</span> price<span class="sy0">:</span> <span class="st0">'$7.00'</span> <span class="br0">&#125;</span><span class="sy0">,</span>
        <span class="st0">'drag4'</span><span class="sy0">:</span> <span class="br0">&#123;</span> color<span class="sy0">:</span> <span class="st0">'red'</span><span class="sy0">,</span> size<span class="sy0">:</span> <span class="st0">'large'</span><span class="sy0">,</span> price<span class="sy0">:</span> <span class="st0">'$10.00'</span> <span class="br0">&#125;</span><span class="sy0">,</span>
        <span class="st0">'drag5'</span><span class="sy0">:</span> <span class="br0">&#123;</span> color<span class="sy0">:</span> <span class="st0">'purple'</span><span class="sy0">,</span> size<span class="sy0">:</span> <span class="st0">'x-large'</span><span class="sy0">,</span> price<span class="sy0">:</span> <span class="st0">'$15.00'</span> <span class="br0">&#125;</span>
    <span class="br0">&#125;</span><span class="sy0">;</span></pre></div><textarea id="syntax-fc4b180bb0ec9a8f9fa7b99cc8fcf032-plain">    var data = {
        'drag1': { color: 'white', size: 'x-small', price: '$5.00' },
        'drag2': { color: 'blue', size: 'small', price: '$6.00' },
        'drag3': { color: 'green', size: 'medium', price: '$7.00' },
        'drag4': { color: 'red', size: 'large', price: '$10.00' },
        'drag5': { color: 'purple', size: 'x-large', price: '$15.00' }
    };</textarea></div><p>Now we walk through the nodes and create a drag instance from each of them.</p>
<div id="syntax-c9b92c6536fc288ba17cd77f3d0268d6" class="yui-syntax-highlight"><div class="numbers"><pre class="javascript" style="font-family:monospace;"><ol><li class="li1"><div class="de1">YUI<span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="kw2">use</span><span class="br0">&#40;</span><span class="st0">'dd-drop'</span><span class="sy0">,</span> <span class="st0">'dd-constrain'</span><span class="sy0">,</span> <span class="kw2">function</span><span class="br0">&#40;</span>Y<span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">    <span class="co1">//Data to attach to each drag object</span></div></li><li class="li1"><div class="de1">    <span class="kw2">var</span> data <span class="sy0">=</span> <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">        <span class="st0">'drag1'</span><span class="sy0">:</span> <span class="br0">&#123;</span> color<span class="sy0">:</span> <span class="st0">'white'</span><span class="sy0">,</span> size<span class="sy0">:</span> <span class="st0">'x-small'</span><span class="sy0">,</span> price<span class="sy0">:</span> <span class="st0">'$5.00'</span> <span class="br0">&#125;</span><span class="sy0">,</span></div></li><li class="li2"><div class="de2">        <span class="st0">'drag2'</span><span class="sy0">:</span> <span class="br0">&#123;</span> color<span class="sy0">:</span> <span class="st0">'blue'</span><span class="sy0">,</span> size<span class="sy0">:</span> <span class="st0">'small'</span><span class="sy0">,</span> price<span class="sy0">:</span> <span class="st0">'$6.00'</span> <span class="br0">&#125;</span><span class="sy0">,</span></div></li><li class="li1"><div class="de1">        <span class="st0">'drag3'</span><span class="sy0">:</span> <span class="br0">&#123;</span> color<span class="sy0">:</span> <span class="st0">'green'</span><span class="sy0">,</span> size<span class="sy0">:</span> <span class="st0">'medium'</span><span class="sy0">,</span> price<span class="sy0">:</span> <span class="st0">'$7.00'</span> <span class="br0">&#125;</span><span class="sy0">,</span></div></li><li class="li1"><div class="de1">        <span class="st0">'drag4'</span><span class="sy0">:</span> <span class="br0">&#123;</span> color<span class="sy0">:</span> <span class="st0">'red'</span><span class="sy0">,</span> size<span class="sy0">:</span> <span class="st0">'large'</span><span class="sy0">,</span> price<span class="sy0">:</span> <span class="st0">'$10.00'</span> <span class="br0">&#125;</span><span class="sy0">,</span></div></li><li class="li1"><div class="de1">        <span class="st0">'drag5'</span><span class="sy0">:</span> <span class="br0">&#123;</span> color<span class="sy0">:</span> <span class="st0">'purple'</span><span class="sy0">,</span> size<span class="sy0">:</span> <span class="st0">'x-large'</span><span class="sy0">,</span> price<span class="sy0">:</span> <span class="st0">'$15.00'</span> <span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">    <span class="br0">&#125;</span><span class="sy0">;</span></div></li><li class="li2"><div class="de2">    <span class="co1">//Get all the divs with the class drag</span></div></li><li class="li1"><div class="de1">    <span class="kw2">var</span> drags <span class="sy0">=</span> Y.<span class="me1">Node</span>.<span class="me1">all</span><span class="br0">&#40;</span><span class="st0">'#play div.drag'</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">    <span class="co1">//Walk through each one</span></div></li><li class="li1"><div class="de1">    drags.<span class="me1">each</span><span class="br0">&#40;</span><span class="kw2">function</span><span class="br0">&#40;</span>v<span class="sy0">,</span> k<span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">        <span class="co1">//scope a local var for the data</span></div></li><li class="li2"><div class="de2">        <span class="kw2">var</span> thisData <span class="sy0">=</span> <span class="br0">&#123;</span><span class="br0">&#125;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">        <span class="co1">//Using Y.mix to break this data from the data above</span></div></li><li class="li1"><div class="de1">        Y.<span class="me1">mix</span><span class="br0">&#40;</span>thisData<span class="sy0">,</span> data<span class="br0">&#91;</span>v.<span class="me1">get</span><span class="br0">&#40;</span><span class="st0">'id'</span><span class="br0">&#41;</span><span class="br0">&#93;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">        <span class="co1">//Create the new Drag Instance</span></div></li><li class="li2"><div class="de2">        <span class="kw2">var</span> dd <span class="sy0">=</span> <span class="kw2">new</span> Y.<span class="me1">DD</span>.<span class="me1">Drag</span><span class="br0">&#40;</span><span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">            <span class="co1">//Give it the node</span></div></li><li class="li1"><div class="de1">            node<span class="sy0">:</span> v<span class="sy0">,</span></div></li><li class="li1"><div class="de1">            <span class="co1">//Set the dragMode to intersect</span></div></li><li class="li1"><div class="de1">            dragMode<span class="sy0">:</span> <span class="st0">'intersect'</span><span class="sy0">,</span></div></li><li class="li2"><div class="de2">            <span class="co1">//Attach the data here.</span></div></li><li class="li1"><div class="de1">            data<span class="sy0">:</span> thisData</div></li><li class="li1"><div class="de1">        <span class="br0">&#125;</span><span class="br0">&#41;</span>.<span class="me1">plug</span><span class="br0">&#40;</span>Y.<span class="me1">Plugin</span>.<span class="me1">DDConstrained</span><span class="sy0">,</span> <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">            <span class="co1">//Keep it inside the work area</span></div></li><li class="li1"><div class="de1">            constrain2node<span class="sy0">:</span> <span class="st0">'#play'</span></div></li><li class="li2"><div class="de2">        <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">        <span class="co1">//Prevent the default end event (this moves the node back to its start position)</span></div></li><li class="li1"><div class="de1">        dd.<span class="me1">on</span><span class="br0">&#40;</span><span class="st0">'drag:end'</span><span class="sy0">,</span> <span class="kw2">function</span><span class="br0">&#40;</span>e<span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">            e.<span class="me1">preventDefault</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">        <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li2"><div class="de2">    <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1"><span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li></ol></pre></div><div class="nonumbers"><pre class="javascript" style="font-family:monospace;">YUI<span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="kw2">use</span><span class="br0">&#40;</span><span class="st0">'dd-drop'</span><span class="sy0">,</span> <span class="st0">'dd-constrain'</span><span class="sy0">,</span> <span class="kw2">function</span><span class="br0">&#40;</span>Y<span class="br0">&#41;</span> <span class="br0">&#123;</span>
    <span class="co1">//Data to attach to each drag object</span>
    <span class="kw2">var</span> data <span class="sy0">=</span> <span class="br0">&#123;</span>
        <span class="st0">'drag1'</span><span class="sy0">:</span> <span class="br0">&#123;</span> color<span class="sy0">:</span> <span class="st0">'white'</span><span class="sy0">,</span> size<span class="sy0">:</span> <span class="st0">'x-small'</span><span class="sy0">,</span> price<span class="sy0">:</span> <span class="st0">'$5.00'</span> <span class="br0">&#125;</span><span class="sy0">,</span>
        <span class="st0">'drag2'</span><span class="sy0">:</span> <span class="br0">&#123;</span> color<span class="sy0">:</span> <span class="st0">'blue'</span><span class="sy0">,</span> size<span class="sy0">:</span> <span class="st0">'small'</span><span class="sy0">,</span> price<span class="sy0">:</span> <span class="st0">'$6.00'</span> <span class="br0">&#125;</span><span class="sy0">,</span>
        <span class="st0">'drag3'</span><span class="sy0">:</span> <span class="br0">&#123;</span> color<span class="sy0">:</span> <span class="st0">'green'</span><span class="sy0">,</span> size<span class="sy0">:</span> <span class="st0">'medium'</span><span class="sy0">,</span> price<span class="sy0">:</span> <span class="st0">'$7.00'</span> <span class="br0">&#125;</span><span class="sy0">,</span>
        <span class="st0">'drag4'</span><span class="sy0">:</span> <span class="br0">&#123;</span> color<span class="sy0">:</span> <span class="st0">'red'</span><span class="sy0">,</span> size<span class="sy0">:</span> <span class="st0">'large'</span><span class="sy0">,</span> price<span class="sy0">:</span> <span class="st0">'$10.00'</span> <span class="br0">&#125;</span><span class="sy0">,</span>
        <span class="st0">'drag5'</span><span class="sy0">:</span> <span class="br0">&#123;</span> color<span class="sy0">:</span> <span class="st0">'purple'</span><span class="sy0">,</span> size<span class="sy0">:</span> <span class="st0">'x-large'</span><span class="sy0">,</span> price<span class="sy0">:</span> <span class="st0">'$15.00'</span> <span class="br0">&#125;</span>
    <span class="br0">&#125;</span><span class="sy0">;</span>
    <span class="co1">//Get all the divs with the class drag</span>
    <span class="kw2">var</span> drags <span class="sy0">=</span> Y.<span class="me1">Node</span>.<span class="me1">all</span><span class="br0">&#40;</span><span class="st0">'#play div.drag'</span><span class="br0">&#41;</span><span class="sy0">;</span>
    <span class="co1">//Walk through each one</span>
    drags.<span class="me1">each</span><span class="br0">&#40;</span><span class="kw2">function</span><span class="br0">&#40;</span>v<span class="sy0">,</span> k<span class="br0">&#41;</span> <span class="br0">&#123;</span>
        <span class="co1">//scope a local var for the data</span>
        <span class="kw2">var</span> thisData <span class="sy0">=</span> <span class="br0">&#123;</span><span class="br0">&#125;</span><span class="sy0">;</span>
        <span class="co1">//Using Y.mix to break this data from the data above</span>
        Y.<span class="me1">mix</span><span class="br0">&#40;</span>thisData<span class="sy0">,</span> data<span class="br0">&#91;</span>v.<span class="me1">get</span><span class="br0">&#40;</span><span class="st0">'id'</span><span class="br0">&#41;</span><span class="br0">&#93;</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
        <span class="co1">//Create the new Drag Instance</span>
        <span class="kw2">var</span> dd <span class="sy0">=</span> <span class="kw2">new</span> Y.<span class="me1">DD</span>.<span class="me1">Drag</span><span class="br0">&#40;</span><span class="br0">&#123;</span>
            <span class="co1">//Give it the node</span>
            node<span class="sy0">:</span> v<span class="sy0">,</span>
            <span class="co1">//Set the dragMode to intersect</span>
            dragMode<span class="sy0">:</span> <span class="st0">'intersect'</span><span class="sy0">,</span>
            <span class="co1">//Attach the data here.</span>
            data<span class="sy0">:</span> thisData
        <span class="br0">&#125;</span><span class="br0">&#41;</span>.<span class="me1">plug</span><span class="br0">&#40;</span>Y.<span class="me1">Plugin</span>.<span class="me1">DDConstrained</span><span class="sy0">,</span> <span class="br0">&#123;</span>
            <span class="co1">//Keep it inside the work area</span>
            constrain2node<span class="sy0">:</span> <span class="st0">'#play'</span>
        <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span>
        <span class="co1">//Prevent the default end event (this moves the node back to its start position)</span>
        dd.<span class="me1">on</span><span class="br0">&#40;</span><span class="st0">'drag:end'</span><span class="sy0">,</span> <span class="kw2">function</span><span class="br0">&#40;</span>e<span class="br0">&#41;</span> <span class="br0">&#123;</span>
            e.<span class="me1">preventDefault</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
        <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span>
    <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span></pre></div><textarea id="syntax-c9b92c6536fc288ba17cd77f3d0268d6-plain">YUI().use('dd-drop', 'dd-constrain', function(Y) {
    //Data to attach to each drag object
    var data = {
        'drag1': { color: 'white', size: 'x-small', price: '$5.00' },
        'drag2': { color: 'blue', size: 'small', price: '$6.00' },
        'drag3': { color: 'green', size: 'medium', price: '$7.00' },
        'drag4': { color: 'red', size: 'large', price: '$10.00' },
        'drag5': { color: 'purple', size: 'x-large', price: '$15.00' }
    };
    //Get all the divs with the class drag
    var drags = Y.Node.all('#play div.drag');
    //Walk through each one
    drags.each(function(v, k) {
        //scope a local var for the data
        var thisData = {};
        //Using Y.mix to break this data from the data above
        Y.mix(thisData, data[v.get('id')]);

        //Create the new Drag Instance
        var dd = new Y.DD.Drag({
            //Give it the node
            node: v,
            //Set the dragMode to intersect
            dragMode: 'intersect',
            //Attach the data here.
            data: thisData
        }).plug(Y.Plugin.DDConstrained, {
            //Keep it inside the work area
            constrain2node: '#play'
        });
        //Prevent the default end event (this moves the node back to its start position)
        dd.on('drag:end', function(e) {
            e.preventDefault();
        });
    });
});</textarea></div>

<h3>Setting up the Drop Target</h3>
<p>Here we set up the Drop Target and assign a listener to it.</p>
<div id="syntax-ded219539e15311a4de39a8c107c4a38" class="yui-syntax-highlight"><div class="numbers"><pre class="javascript" style="font-family:monospace;"><ol><li class="li1"><div class="de1"><span class="kw2">var</span> drop <span class="sy0">=</span> <span class="kw2">new</span> Y.<span class="me1">DD</span>.<span class="me1">Drop</span><span class="br0">&#40;</span><span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">    node<span class="sy0">:</span> <span class="st0">'#drop'</span></div></li><li class="li1"><div class="de1"><span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1"><span class="co1">//Listen for a drop:hit on this target</span></div></li><li class="li2"><div class="de2">drop.<span class="me1">on</span><span class="br0">&#40;</span><span class="st0">'drop:hit'</span><span class="sy0">,</span> <span class="kw2">function</span><span class="br0">&#40;</span>e<span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">    <span class="co1">//Now we get the drag instance that triggered the drop hit</span></div></li><li class="li1"><div class="de1">    <span class="kw2">var</span> drag <span class="sy0">=</span> e.<span class="me1">drag</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">    <span class="co1">//get the data from it</span></div></li><li class="li1"><div class="de1">    <span class="kw2">var</span> data <span class="sy0">=</span> drag.<span class="me1">get</span><span class="br0">&#40;</span><span class="st0">'data'</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li2"><div class="de2">&nbsp;</div></li><li class="li1"><div class="de1">    <span class="co1">//Do something with the data</span></div></li><li class="li1"><div class="de1">    <span class="kw2">var</span> out <span class="sy0">=</span> <span class="br0">&#91;</span><span class="st0">'id: '</span> <span class="sy0">+</span> drag.<span class="me1">get</span><span class="br0">&#40;</span><span class="st0">'node'</span><span class="br0">&#41;</span>.<span class="me1">get</span><span class="br0">&#40;</span><span class="st0">'id'</span><span class="br0">&#41;</span><span class="br0">&#93;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">    Y.<span class="me1">each</span><span class="br0">&#40;</span>data<span class="sy0">,</span> <span class="kw2">function</span><span class="br0">&#40;</span>v<span class="sy0">,</span> k<span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">        out<span class="br0">&#91;</span>out.<span class="me1">length</span><span class="br0">&#93;</span> <span class="sy0">=</span> k <span class="sy0">+</span> <span class="st0">': '</span> <span class="sy0">+</span> v<span class="sy0">;</span></div></li><li class="li2"><div class="de2">    <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">    <span class="kw2">var</span> str <span class="sy0">=</span> <span class="st0">'&lt;p&gt;&lt;strong&gt;Dropped&lt;/strong&gt;: '</span> <span class="sy0">+</span> out.<span class="me1">join</span><span class="br0">&#40;</span><span class="st0">', '</span><span class="br0">&#41;</span> <span class="sy0">+</span> <span class="st0">'&lt;/p&gt;'</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">    <span class="kw1">this</span>.<span class="me1">get</span><span class="br0">&#40;</span><span class="st0">'node'</span><span class="br0">&#41;</span>.<span class="me1">set</span><span class="br0">&#40;</span><span class="st0">'innerHTML'</span><span class="sy0">,</span> str<span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1"><span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li></ol></pre></div><div class="nonumbers"><pre class="javascript" style="font-family:monospace;"><span class="kw2">var</span> drop <span class="sy0">=</span> <span class="kw2">new</span> Y.<span class="me1">DD</span>.<span class="me1">Drop</span><span class="br0">&#40;</span><span class="br0">&#123;</span>
    node<span class="sy0">:</span> <span class="st0">'#drop'</span>
<span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="co1">//Listen for a drop:hit on this target</span>
drop.<span class="me1">on</span><span class="br0">&#40;</span><span class="st0">'drop:hit'</span><span class="sy0">,</span> <span class="kw2">function</span><span class="br0">&#40;</span>e<span class="br0">&#41;</span> <span class="br0">&#123;</span>
    <span class="co1">//Now we get the drag instance that triggered the drop hit</span>
    <span class="kw2">var</span> drag <span class="sy0">=</span> e.<span class="me1">drag</span><span class="sy0">;</span>
    <span class="co1">//get the data from it</span>
    <span class="kw2">var</span> data <span class="sy0">=</span> drag.<span class="me1">get</span><span class="br0">&#40;</span><span class="st0">'data'</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
    <span class="co1">//Do something with the data</span>
    <span class="kw2">var</span> out <span class="sy0">=</span> <span class="br0">&#91;</span><span class="st0">'id: '</span> <span class="sy0">+</span> drag.<span class="me1">get</span><span class="br0">&#40;</span><span class="st0">'node'</span><span class="br0">&#41;</span>.<span class="me1">get</span><span class="br0">&#40;</span><span class="st0">'id'</span><span class="br0">&#41;</span><span class="br0">&#93;</span><span class="sy0">;</span>
    Y.<span class="me1">each</span><span class="br0">&#40;</span>data<span class="sy0">,</span> <span class="kw2">function</span><span class="br0">&#40;</span>v<span class="sy0">,</span> k<span class="br0">&#41;</span> <span class="br0">&#123;</span>
        out<span class="br0">&#91;</span>out.<span class="me1">length</span><span class="br0">&#93;</span> <span class="sy0">=</span> k <span class="sy0">+</span> <span class="st0">': '</span> <span class="sy0">+</span> v<span class="sy0">;</span>
    <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span>
    <span class="kw2">var</span> str <span class="sy0">=</span> <span class="st0">'&lt;p&gt;&lt;strong&gt;Dropped&lt;/strong&gt;: '</span> <span class="sy0">+</span> out.<span class="me1">join</span><span class="br0">&#40;</span><span class="st0">', '</span><span class="br0">&#41;</span> <span class="sy0">+</span> <span class="st0">'&lt;/p&gt;'</span><span class="sy0">;</span>
    <span class="kw1">this</span>.<span class="me1">get</span><span class="br0">&#40;</span><span class="st0">'node'</span><span class="br0">&#41;</span>.<span class="me1">set</span><span class="br0">&#40;</span><span class="st0">'innerHTML'</span><span class="sy0">,</span> str<span class="br0">&#41;</span><span class="sy0">;</span>
<span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span></pre></div><textarea id="syntax-ded219539e15311a4de39a8c107c4a38-plain">var drop = new Y.DD.Drop({
    node: '#drop'
});
//Listen for a drop:hit on this target
drop.on('drop:hit', function(e) {
    //Now we get the drag instance that triggered the drop hit
    var drag = e.drag;
    //get the data from it
    var data = drag.get('data');

    //Do something with the data
    var out = ['id: ' + drag.get('node').get('id')];
    Y.each(data, function(v, k) {
        out[out.length] = k + ': ' + v;
    });
    var str = '<p><strong>Dropped</strong>: ' + out.join(', ') + '</p>';
    this.get('node').set('innerHTML', str);
});</textarea></div>
<h3>Full Example Source</h3>
<div id="syntax-f400bde416397fd3180b3fd4272467fe" class="yui-syntax-highlight"><div class="numbers"><pre class="javascript" style="font-family:monospace;"><ol><li class="li1"><div class="de1">YUI<span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="kw2">use</span><span class="br0">&#40;</span><span class="st0">'dd-drop'</span><span class="sy0">,</span> <span class="st0">'dd-constrain'</span><span class="sy0">,</span> <span class="kw2">function</span><span class="br0">&#40;</span>Y<span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">    <span class="kw2">var</span> data <span class="sy0">=</span> <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">        <span class="st0">'drag1'</span><span class="sy0">:</span> <span class="br0">&#123;</span> color<span class="sy0">:</span> <span class="st0">'white'</span><span class="sy0">,</span> size<span class="sy0">:</span> <span class="st0">'x-small'</span><span class="sy0">,</span> price<span class="sy0">:</span> <span class="st0">'$5.00'</span> <span class="br0">&#125;</span><span class="sy0">,</span></div></li><li class="li1"><div class="de1">        <span class="st0">'drag2'</span><span class="sy0">:</span> <span class="br0">&#123;</span> color<span class="sy0">:</span> <span class="st0">'blue'</span><span class="sy0">,</span> size<span class="sy0">:</span> <span class="st0">'small'</span><span class="sy0">,</span> price<span class="sy0">:</span> <span class="st0">'$6.00'</span> <span class="br0">&#125;</span><span class="sy0">,</span></div></li><li class="li2"><div class="de2">        <span class="st0">'drag3'</span><span class="sy0">:</span> <span class="br0">&#123;</span> color<span class="sy0">:</span> <span class="st0">'green'</span><span class="sy0">,</span> size<span class="sy0">:</span> <span class="st0">'medium'</span><span class="sy0">,</span> price<span class="sy0">:</span> <span class="st0">'$7.00'</span> <span class="br0">&#125;</span><span class="sy0">,</span></div></li><li class="li1"><div class="de1">        <span class="st0">'drag4'</span><span class="sy0">:</span> <span class="br0">&#123;</span> color<span class="sy0">:</span> <span class="st0">'red'</span><span class="sy0">,</span> size<span class="sy0">:</span> <span class="st0">'large'</span><span class="sy0">,</span> price<span class="sy0">:</span> <span class="st0">'$10.00'</span> <span class="br0">&#125;</span><span class="sy0">,</span></div></li><li class="li1"><div class="de1">        <span class="st0">'drag5'</span><span class="sy0">:</span> <span class="br0">&#123;</span> color<span class="sy0">:</span> <span class="st0">'purple'</span><span class="sy0">,</span> size<span class="sy0">:</span> <span class="st0">'x-large'</span><span class="sy0">,</span> price<span class="sy0">:</span> <span class="st0">'$15.00'</span> <span class="br0">&#125;</span></div></li><li class="li1"><div class="de1">    <span class="br0">&#125;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">    <span class="kw2">var</span> drags <span class="sy0">=</span> Y.<span class="me1">Node</span>.<span class="me1">all</span><span class="br0">&#40;</span><span class="st0">'#play div.drag'</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li2"><div class="de2">    drags.<span class="me1">each</span><span class="br0">&#40;</span><span class="kw2">function</span><span class="br0">&#40;</span>v<span class="sy0">,</span> k<span class="sy0">,</span> items<span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">        <span class="kw2">var</span> thisData <span class="sy0">=</span> <span class="br0">&#123;</span><span class="br0">&#125;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">        Y.<span class="me1">mix</span><span class="br0">&#40;</span>thisData<span class="sy0">,</span> data<span class="br0">&#91;</span>v.<span class="me1">get</span><span class="br0">&#40;</span><span class="st0">'id'</span><span class="br0">&#41;</span><span class="br0">&#93;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">        <span class="kw2">var</span> dd <span class="sy0">=</span> <span class="kw2">new</span> Y.<span class="me1">DD</span>.<span class="me1">Drag</span><span class="br0">&#40;</span><span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">            node<span class="sy0">:</span> items.<span class="kw1">item</span><span class="br0">&#40;</span>k<span class="br0">&#41;</span><span class="sy0">,</span></div></li><li class="li2"><div class="de2">            dragMode<span class="sy0">:</span> <span class="st0">'intersect'</span><span class="sy0">,</span></div></li><li class="li1"><div class="de1">            data<span class="sy0">:</span> thisData</div></li><li class="li1"><div class="de1">        <span class="br0">&#125;</span><span class="br0">&#41;</span>.<span class="me1">plug</span><span class="br0">&#40;</span>Y.<span class="me1">Plugin</span>.<span class="me1">DDConstrained</span><span class="sy0">,</span> <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">            <span class="co1">//Keep it inside the work area</span></div></li><li class="li1"><div class="de1">            constrain2node<span class="sy0">:</span> <span class="st0">'#play'</span></div></li><li class="li2"><div class="de2">        <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">        <span class="co1">//Prevent the default end event (this moves the node back to its start position)</span></div></li><li class="li1"><div class="de1">        dd.<span class="me1">on</span><span class="br0">&#40;</span><span class="st0">'drag:end'</span><span class="sy0">,</span> <span class="kw2">function</span><span class="br0">&#40;</span>e<span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">            e.<span class="me1">preventDefault</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">        <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li2"><div class="de2">    <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">&nbsp;</div></li><li class="li1"><div class="de1">    <span class="kw2">var</span> drop <span class="sy0">=</span> <span class="kw2">new</span> Y.<span class="me1">DD</span>.<span class="me1">Drop</span><span class="br0">&#40;</span><span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">        node<span class="sy0">:</span> <span class="st0">'#drop'</span></div></li><li class="li1"><div class="de1">    <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li2"><div class="de2">    drop.<span class="me1">on</span><span class="br0">&#40;</span><span class="st0">'drop:hit'</span><span class="sy0">,</span> <span class="kw2">function</span><span class="br0">&#40;</span>e<span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li><li class="li1"><div class="de1">        <span class="kw2">var</span> drag <span class="sy0">=</span> e.<span class="me1">drag</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">        <span class="kw2">var</span> data <span class="sy0">=</span> drag.<span class="me1">get</span><span class="br0">&#40;</span><span class="st0">'data'</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">        <span class="kw2">var</span> out <span class="sy0">=</span> <span class="br0">&#91;</span><span class="st0">'id: '</span> <span class="sy0">+</span> drag.<span class="me1">get</span><span class="br0">&#40;</span><span class="st0">'node'</span><span class="br0">&#41;</span>.<span class="me1">get</span><span class="br0">&#40;</span><span class="st0">'id'</span><span class="br0">&#41;</span><span class="br0">&#93;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">        Y.<span class="me1">each</span><span class="br0">&#40;</span>data<span class="sy0">,</span> <span class="kw2">function</span><span class="br0">&#40;</span>v<span class="sy0">,</span> k<span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li><li class="li2"><div class="de2">            out<span class="br0">&#91;</span>out.<span class="me1">length</span><span class="br0">&#93;</span> <span class="sy0">=</span> k <span class="sy0">+</span> <span class="st0">': '</span> <span class="sy0">+</span> v<span class="sy0">;</span></div></li><li class="li1"><div class="de1">        <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">        <span class="kw2">var</span> str <span class="sy0">=</span> <span class="st0">'&lt;p&gt;&lt;strong&gt;Dropped&lt;/strong&gt;: '</span> <span class="sy0">+</span> out.<span class="me1">join</span><span class="br0">&#40;</span><span class="st0">', '</span><span class="br0">&#41;</span> <span class="sy0">+</span> <span class="st0">'&lt;/p&gt;'</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">        <span class="kw1">this</span>.<span class="me1">get</span><span class="br0">&#40;</span><span class="st0">'node'</span><span class="br0">&#41;</span>.<span class="me1">set</span><span class="br0">&#40;</span><span class="st0">'innerHTML'</span><span class="sy0">,</span> str<span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li1"><div class="de1">    <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li><li class="li2"><div class="de2"><span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></li></ol></pre></div><div class="nonumbers"><pre class="javascript" style="font-family:monospace;">YUI<span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="kw2">use</span><span class="br0">&#40;</span><span class="st0">'dd-drop'</span><span class="sy0">,</span> <span class="st0">'dd-constrain'</span><span class="sy0">,</span> <span class="kw2">function</span><span class="br0">&#40;</span>Y<span class="br0">&#41;</span> <span class="br0">&#123;</span>
    <span class="kw2">var</span> data <span class="sy0">=</span> <span class="br0">&#123;</span>
        <span class="st0">'drag1'</span><span class="sy0">:</span> <span class="br0">&#123;</span> color<span class="sy0">:</span> <span class="st0">'white'</span><span class="sy0">,</span> size<span class="sy0">:</span> <span class="st0">'x-small'</span><span class="sy0">,</span> price<span class="sy0">:</span> <span class="st0">'$5.00'</span> <span class="br0">&#125;</span><span class="sy0">,</span>
        <span class="st0">'drag2'</span><span class="sy0">:</span> <span class="br0">&#123;</span> color<span class="sy0">:</span> <span class="st0">'blue'</span><span class="sy0">,</span> size<span class="sy0">:</span> <span class="st0">'small'</span><span class="sy0">,</span> price<span class="sy0">:</span> <span class="st0">'$6.00'</span> <span class="br0">&#125;</span><span class="sy0">,</span>
        <span class="st0">'drag3'</span><span class="sy0">:</span> <span class="br0">&#123;</span> color<span class="sy0">:</span> <span class="st0">'green'</span><span class="sy0">,</span> size<span class="sy0">:</span> <span class="st0">'medium'</span><span class="sy0">,</span> price<span class="sy0">:</span> <span class="st0">'$7.00'</span> <span class="br0">&#125;</span><span class="sy0">,</span>
        <span class="st0">'drag4'</span><span class="sy0">:</span> <span class="br0">&#123;</span> color<span class="sy0">:</span> <span class="st0">'red'</span><span class="sy0">,</span> size<span class="sy0">:</span> <span class="st0">'large'</span><span class="sy0">,</span> price<span class="sy0">:</span> <span class="st0">'$10.00'</span> <span class="br0">&#125;</span><span class="sy0">,</span>
        <span class="st0">'drag5'</span><span class="sy0">:</span> <span class="br0">&#123;</span> color<span class="sy0">:</span> <span class="st0">'purple'</span><span class="sy0">,</span> size<span class="sy0">:</span> <span class="st0">'x-large'</span><span class="sy0">,</span> price<span class="sy0">:</span> <span class="st0">'$15.00'</span> <span class="br0">&#125;</span>
    <span class="br0">&#125;</span><span class="sy0">;</span>
    <span class="kw2">var</span> drags <span class="sy0">=</span> Y.<span class="me1">Node</span>.<span class="me1">all</span><span class="br0">&#40;</span><span class="st0">'#play div.drag'</span><span class="br0">&#41;</span><span class="sy0">;</span>
    drags.<span class="me1">each</span><span class="br0">&#40;</span><span class="kw2">function</span><span class="br0">&#40;</span>v<span class="sy0">,</span> k<span class="sy0">,</span> items<span class="br0">&#41;</span> <span class="br0">&#123;</span>
        <span class="kw2">var</span> thisData <span class="sy0">=</span> <span class="br0">&#123;</span><span class="br0">&#125;</span><span class="sy0">;</span>
        Y.<span class="me1">mix</span><span class="br0">&#40;</span>thisData<span class="sy0">,</span> data<span class="br0">&#91;</span>v.<span class="me1">get</span><span class="br0">&#40;</span><span class="st0">'id'</span><span class="br0">&#41;</span><span class="br0">&#93;</span><span class="br0">&#41;</span><span class="sy0">;</span>
        <span class="kw2">var</span> dd <span class="sy0">=</span> <span class="kw2">new</span> Y.<span class="me1">DD</span>.<span class="me1">Drag</span><span class="br0">&#40;</span><span class="br0">&#123;</span>
            node<span class="sy0">:</span> items.<span class="kw1">item</span><span class="br0">&#40;</span>k<span class="br0">&#41;</span><span class="sy0">,</span>
            dragMode<span class="sy0">:</span> <span class="st0">'intersect'</span><span class="sy0">,</span>
            data<span class="sy0">:</span> thisData
        <span class="br0">&#125;</span><span class="br0">&#41;</span>.<span class="me1">plug</span><span class="br0">&#40;</span>Y.<span class="me1">Plugin</span>.<span class="me1">DDConstrained</span><span class="sy0">,</span> <span class="br0">&#123;</span>
            <span class="co1">//Keep it inside the work area</span>
            constrain2node<span class="sy0">:</span> <span class="st0">'#play'</span>
        <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span>
        <span class="co1">//Prevent the default end event (this moves the node back to its start position)</span>
        dd.<span class="me1">on</span><span class="br0">&#40;</span><span class="st0">'drag:end'</span><span class="sy0">,</span> <span class="kw2">function</span><span class="br0">&#40;</span>e<span class="br0">&#41;</span> <span class="br0">&#123;</span>
            e.<span class="me1">preventDefault</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
        <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span>
    <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
    <span class="kw2">var</span> drop <span class="sy0">=</span> <span class="kw2">new</span> Y.<span class="me1">DD</span>.<span class="me1">Drop</span><span class="br0">&#40;</span><span class="br0">&#123;</span>
        node<span class="sy0">:</span> <span class="st0">'#drop'</span>
    <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span>
    drop.<span class="me1">on</span><span class="br0">&#40;</span><span class="st0">'drop:hit'</span><span class="sy0">,</span> <span class="kw2">function</span><span class="br0">&#40;</span>e<span class="br0">&#41;</span> <span class="br0">&#123;</span>
        <span class="kw2">var</span> drag <span class="sy0">=</span> e.<span class="me1">drag</span><span class="sy0">;</span>
        <span class="kw2">var</span> data <span class="sy0">=</span> drag.<span class="me1">get</span><span class="br0">&#40;</span><span class="st0">'data'</span><span class="br0">&#41;</span><span class="sy0">;</span>
        <span class="kw2">var</span> out <span class="sy0">=</span> <span class="br0">&#91;</span><span class="st0">'id: '</span> <span class="sy0">+</span> drag.<span class="me1">get</span><span class="br0">&#40;</span><span class="st0">'node'</span><span class="br0">&#41;</span>.<span class="me1">get</span><span class="br0">&#40;</span><span class="st0">'id'</span><span class="br0">&#41;</span><span class="br0">&#93;</span><span class="sy0">;</span>
        Y.<span class="me1">each</span><span class="br0">&#40;</span>data<span class="sy0">,</span> <span class="kw2">function</span><span class="br0">&#40;</span>v<span class="sy0">,</span> k<span class="br0">&#41;</span> <span class="br0">&#123;</span>
            out<span class="br0">&#91;</span>out.<span class="me1">length</span><span class="br0">&#93;</span> <span class="sy0">=</span> k <span class="sy0">+</span> <span class="st0">': '</span> <span class="sy0">+</span> v<span class="sy0">;</span>
        <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span>
        <span class="kw2">var</span> str <span class="sy0">=</span> <span class="st0">'&lt;p&gt;&lt;strong&gt;Dropped&lt;/strong&gt;: '</span> <span class="sy0">+</span> out.<span class="me1">join</span><span class="br0">&#40;</span><span class="st0">', '</span><span class="br0">&#41;</span> <span class="sy0">+</span> <span class="st0">'&lt;/p&gt;'</span><span class="sy0">;</span>
        <span class="kw1">this</span>.<span class="me1">get</span><span class="br0">&#40;</span><span class="st0">'node'</span><span class="br0">&#41;</span>.<span class="me1">set</span><span class="br0">&#40;</span><span class="st0">'innerHTML'</span><span class="sy0">,</span> str<span class="br0">&#41;</span><span class="sy0">;</span>
    <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span></pre></div><textarea id="syntax-f400bde416397fd3180b3fd4272467fe-plain">YUI().use('dd-drop', 'dd-constrain', function(Y) {
    var data = {
        'drag1': { color: 'white', size: 'x-small', price: '$5.00' },
        'drag2': { color: 'blue', size: 'small', price: '$6.00' },
        'drag3': { color: 'green', size: 'medium', price: '$7.00' },
        'drag4': { color: 'red', size: 'large', price: '$10.00' },
        'drag5': { color: 'purple', size: 'x-large', price: '$15.00' }
    };
    var drags = Y.Node.all('#play div.drag');
    drags.each(function(v, k, items) {
        var thisData = {};
        Y.mix(thisData, data[v.get('id')]);
        var dd = new Y.DD.Drag({
            node: items.item(k),
            dragMode: 'intersect',
            data: thisData
        }).plug(Y.Plugin.DDConstrained, {
            //Keep it inside the work area
            constrain2node: '#play'
        });
        //Prevent the default end event (this moves the node back to its start position)
        dd.on('drag:end', function(e) {
            e.preventDefault();
        });
    });

    var drop = new Y.DD.Drop({
        node: '#drop'
    });
    drop.on('drop:hit', function(e) {
        var drag = e.drag;
        var data = drag.get('data');
        var out = ['id: ' + drag.get('node').get('id')];
        Y.each(data, function(v, k) {
            out[out.length] = k + ': ' + v;
        });
        var str = '<p><strong>Dropped</strong>: ' + out.join(', ') + '</p>';
        this.get('node').set('innerHTML', str);
    });
});</textarea></div>				</div>
				<div class="yui-u sidebar">
	
					<div id="examples" class="mod box4">
                        <div class="hd">
						<h4>
    Drag &amp; Drop Examples:</h4>
                        </div>
						<div class="bd">
							<ul>
								<li><a href='../dd/simple-drag.html'>Simple Drag</a></li><li><a href='../dd/drag-plugin.html'>Drag Node Plugin</a></li><li><a href='../dd/proxy-drag.html'>Proxy Drag</a></li><li><a href='../dd/constrained-drag.html'>Drag Constrained to a Region</a></li><li><a href='../dd/groups-drag.html'>Interaction Groups</a></li><li><a href='../dd/shim-drag.html'>Using the Drag Shim</a></li><li><a href='../dd/anim-drop.html'>Animated Drop Targets</a></li><li class='selected'><a href='../dd/drop-code.html'>Drop Based Coding</a></li><li><a href='../dd/winscroll.html'>Window Scrolling</a></li><li><a href='../dd/delegate.html'>Drag Delegation</a></li><li><a href='../dd/delegate-drop.html'>Drag Delegation with a Drop Target</a></li><li><a href='../dd/delegate-plugins.html'>Using Drag Plugins with Delegate</a></li><li><a href='../dd/list-drag.html'>List Reorder w/Bubbling</a></li><li><a href='../dd/scroll-list.html'>List Reorder w/Scrolling</a></li><li><a href='../dd/portal-drag.html'>Portal Style Example</a></li><li><a href='../dd/photo-browser.html'>Photo Browser</a></li><li><a href='../stylesheet/stylesheet_theme.html'>Adjusting a Page Theme on the Fly (included with examples for StyleSheet)</a></li>							</ul>
						</div>
					</div>

					<div class="mod box4">
                        <div class="hd">
						<h4>More Drag &amp; Drop Resources:</h4>
                        </div>
                        <div class="bd">
						<ul>
							<!-- <li><a href="http://developer.yahoo.com/yui/dd/">User's Guide</a> (external)</li> -->
<li><a href="../../api/module_dd.html">API Documentation</a></li></ul>
                        </div>
					</div>
			  </div>
		</div>

		</div>
	</div>


<div class="yui-b toc3" id="tocWrapper">
<!-- TABLE OF CONTENTS -->
<div id="toc">
	
<ul>
<li class="sect first">YUI 3 Resources</li><li class="item"><a title="YUI 3 -- Yahoo! User Interface (YUI) Library" href="http://developer.yahoo.com/yui/3/">YUI 3 Web Site</a></li><li class="item"><a title="Examples of every YUI utility and control in action" href="../../examples/">YUI 3 Examples</a></li><li class="item"><a title="Instantly searchable API documentation for the entire YUI library." href="../../api/">YUI 3 API Docs</a></li><li class="item"><a title="YUI 3 Dependency Configurator -- configure your custom YUI implementation" href="http://developer.yahoo.com/yui/3/configurator/index.html">YUI 3 Dependency Configurator</a></li><li class="item"><a title="The YUI 3 Forum on YUILibrary.com" href="http://yuilibrary.com/forum/viewforum.php?f=15">YUI 3 Forums (external)</a></li><li class="item"><a title="Found a bug or a missing feature? Let us know on YUILibrary.com." href="http://developer.yahoo.com/yui/articles/reportingbugs/">Bug Reports/Feature Requests</a></li><li class="item"><a title="YUI is free and open, offered under a BSD license." href="http://developer.yahoo.com/yui/license.html">YUI License</a></li><li class="item"><a title="Download and fork the YUI project on GitHub" href="http://github.com/yui">YUI on Github</a></li><li class="item"><a title="The Yahoo! User Interface Blog" href="http://yuiblog.com">YUI Blog (external)</a></li><li class="sect">YUI 3 Core - Examples</li><li class="item"><a title="YUI Global Object - Functional Examples" href="../../examples/yui/index.html">YUI Global Object</a></li><li class="item"><a title="Event - Functional Examples" href="../../examples/event/index.html">Event</a></li><li class="item"><a title="Node - Functional Examples" href="../../examples/node/index.html">Node</a></li><li class="sect">YUI 3 Component Infrastructure - Examples</li><li class="item"><a title="Attribute - Functional Examples" href="../../examples/attribute/index.html">Attribute</a></li><li class="item"><a title="Plugin - Functional Examples" href="../../examples/plugin/index.html">Plugin</a></li><li class="item"><a title="Widget - Functional Examples" href="../../examples/widget/index.html">Widget</a></li><li class="sect">YUI 3 Utilities - Examples</li><li class="item"><a title="Animation - Functional Examples" href="../../examples/anim/index.html">Animation</a></li><li class="item"><a title="AsyncQueue - Functional Examples" href="../../examples/async-queue/index.html">AsyncQueue</a></li><li class="item"><a title="Cache - Functional Examples" href="../../examples/cache/index.html">Cache</a></li><li class="item"><a title="Cookie - Functional Examples" href="../../examples/cookie/index.html">Cookie</a></li><li class="item"><a title="DataSchema - Functional Examples" href="../../examples/dataschema/index.html">DataSchema <img alt='beta' src='http://l.yimg.com/a/i/not/beta_1.gif'></a></li><li class="item"><a title="DataSource - Functional Examples" href="../../examples/datasource/index.html">DataSource <img alt='beta' src='http://l.yimg.com/a/i/not/beta_1.gif'></a></li><li class="item"><a title="DataType - Functional Examples" href="../../examples/datatype/index.html">DataType <img alt='beta' src='http://l.yimg.com/a/i/not/beta_1.gif'></a></li><li class="selected "><a title="Drag &amp; Drop - Functional Examples" href="../../examples/dd/index.html">Drag &amp; Drop</a></li><li class="item"><a title="Get - Functional Examples" href="../../examples/get/index.html">Get</a></li><li class="item"><a title="History - Functional Examples" href="../../examples/history/index.html">History <img alt='beta' src='http://l.yimg.com/a/i/not/beta_1.gif'></a></li><li class="item"><a title="IO - Functional Examples" href="../../examples/io/index.html">IO</a></li><li class="item"><a title="ImageLoader - Functional Examples" href="../../examples/imageloader/index.html">ImageLoader</a></li><li class="item"><a title="Internationalization - Functional Examples" href="../../examples/intl/index.html">Internationalization</a></li><li class="item"><a title="JSON (JavaScript Object Notation) - Functional Examples" href="../../examples/json/index.html">JSON</a></li><li class="item"><a title="JSONP (JSON with Padding) - Functional Examples" href="../../examples/jsonp/index.html">JSONP <img alt='beta' src='http://l.yimg.com/a/i/not/beta_1.gif'></a></li><li class="item"><a title="Recordset - Functional Examples" href="../../examples/recordset/index.html">Recordset <img alt='beta' src='http://l.yimg.com/a/i/not/beta_1.gif'></a></li><li class="item"><a title="Resize - Functional Examples" href="../../examples/resize/index.html">Resize <img alt='beta' src='http://l.yimg.com/a/i/not/beta_1.gif'></a></li><li class="item"><a title="Sortable - Functional Examples" href="../../examples/sortable/index.html">Sortable <img alt='beta' src='http://l.yimg.com/a/i/not/beta_1.gif'></a></li><li class="item"><a title="Stylesheet - Functional Examples" href="../../examples/stylesheet/index.html">Stylesheet</a></li><li class="item"><a title="Transition - Functional Examples" href="../../examples/transition/index.html">Transition <img alt='beta' src='http://l.yimg.com/a/i/not/beta_1.gif'></a></li><li class="item"><a title="Uploader - Functional Examples" href="../../examples/uploader/index.html">Uploader <img alt='beta' src='http://l.yimg.com/a/i/not/beta_1.gif'></a></li><li class="item"><a title="YQL Query - Functional Examples" href="../../examples/yql/index.html">YQL Query <img alt='beta' src='http://l.yimg.com/a/i/not/beta_1.gif'></a></li><li class="sect">YUI 3 Widgets - Examples</li><li class="item"><a title="AutoComplete - Functional Examples" href="../../examples/autocomplete/index.html">AutoComplete <img alt='beta' src='http://l.yimg.com/a/i/not/beta_1.gif'></a></li><li class="item"><a title="Charts - Functional Examples" href="../../examples/charts/index.html">Charts <img alt='beta' src='http://l.yimg.com/a/i/not/beta_1.gif'></a></li><li class="item"><a title="DataTable - Functional Examples" href="../../examples/datatable/index.html">DataTable <img alt='beta' src='http://l.yimg.com/a/i/not/beta_1.gif'></a></li><li class="item"><a title="Dial - Functional Examples" href="../../examples/dial/index.html">Dial <img alt='beta' src='http://l.yimg.com/a/i/not/beta_1.gif'></a></li><li class="item"><a title="Editor - Functional Examples" href="../../examples/editor/index.html">Editor <img alt='beta' src='http://l.yimg.com/a/i/not/beta_1.gif'></a></li><li class="item"><a title="Overlay - Functional Examples" href="../../examples/overlay/index.html">Overlay <img alt='beta' src='http://l.yimg.com/a/i/not/beta_1.gif'></a></li><li class="item"><a title="ScrollView - Functional Examples" href="../../examples/scrollview/index.html">ScrollView <img alt='beta' src='http://l.yimg.com/a/i/not/beta_1.gif'></a></li><li class="item"><a title="Slider - Functional Examples" href="../../examples/slider/index.html">Slider <img alt='beta' src='http://l.yimg.com/a/i/not/beta_1.gif'></a></li><li class="item"><a title="TabView - Functional Examples" href="../../examples/tabview/index.html">TabView <img alt='beta' src='http://l.yimg.com/a/i/not/beta_1.gif'></a></li><li class="sect">YUI 3 Node Plugins - Examples</li><li class="item"><a title="FocusManager Node Plugin - Functional Examples" href="../../examples/node-focusmanager/index.html">FocusManager Node Plugin <img alt='beta' src='http://l.yimg.com/a/i/not/beta_1.gif'></a></li><li class="item"><a title="MenuNav Node Plugin - Functional Examples" href="../../examples/node-menunav/index.html">MenuNav Node Plugin <img alt='beta' src='http://l.yimg.com/a/i/not/beta_1.gif'></a></li><li class="sect">YUI 3 CSS - Examples</li><li class="item"><a title="YUI Base - Functional Examples" href="../../examples/cssbase/index.html">CSS Base</a></li><li class="item"><a title="YUI Fonts - Functional Examples" href="../../examples/cssfonts/index.html">CSS Fonts</a></li><li class="item"><a title="YUI Grids - Functional Examples" href="../../examples/cssgrids/index.html">CSS Grids <img alt='beta' src='http://l.yimg.com/a/i/not/beta_1.gif'></a></li><li class="item"><a title="YUI CSS Reset - Functional Examples" href="../../examples/cssreset/index.html">CSS Reset</a></li><li class="sect">YUI 3 Developer Tools - Examples</li><li class="item"><a title="Console - Functional Examples" href="../../examples/console/index.html">Console <img alt='beta' src='http://l.yimg.com/a/i/not/beta_1.gif'></a></li><li class="item"><a title="Console Filters Plugin- Functional Examples" href="../../examples/console-filters/index.html">Plugin.ConsoleFilters <img alt='beta' src='http://l.yimg.com/a/i/not/beta_1.gif'></a></li><li class="item"><a title="Profiler - Functional Examples" href="../../examples/profiler/index.html">Profiler</a></li><li class="item"><a title="Test - Functional Examples" href="../../examples/test/index.html">Test</a></li><li class="sect">Other Useful YUI 3 Resources</li><li class="item"><a title="Answers to Frequently Asked Questions about the YUI Library" href="http://developer.yahoo.com/yui/articles/faq/">YUI FAQ (external)</a></li><li class="item"><a title="Yahoo!'s philosophy of Graded Browser Support" href="http://developer.yahoo.com/yui/articles/gbs/">Graded Browser Support (external)</a></li><li class="item"><a title="Videos and podcasts from the YUI Team and from the Yahoo! frontend engineering community." href="http://developer.yahoo.com/yui/theater/">YUI Theater (external)</a></li></ul>
</div>
</div>
	</div><!--closes bd-->

	<div id="ft">
        <p class="first">Copyright &copy; 2011 Yahoo! Inc. All rights reserved.</p>
        <p><a href="http://privacy.yahoo.com/privacy/us/devel/index.html">Privacy Policy</a> - 
            <a href="http://docs.yahoo.com/info/terms/">Terms of Service</a> - 
            <a href="http://docs.yahoo.com/info/copyright/copyright.html">Copyright Policy</a> - 
            <a href="http://careers.yahoo.com/">Job Openings</a></p>
	</div>
</div>
<script language="javascript"> 
var yuiConfig = { filter: 'raw' };
</script>
<script src="../../assets/syntax.js"></script>
<script src="../../assets/dpSyntaxHighlighter.js"></script>
<script language="javascript"> 
dp.SyntaxHighlighter.HighlightAll('code'); 
</script>
</body>
</html>
